﻿using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Inovout.Web.Mvc;
using Inovout.YunYao.Models;
using Inovout.YunYao.Services;

namespace Inovout.YunYao.Solutions.Web.Controllers
{
    [AllowAnonymous]
    public class SolutionController : RepositoryController<Solution>
    {
        protected ISolutionService SolutionService
        {
            get { return (ISolutionService)base.RepositoryService; }
        }
        public Solution Solution { get; private set; }
        protected override void Initialize(RequestContext requestContext)
        {
            RouteData routeData = requestContext.RouteData;
            Solution = SolutionService.FindByCode(int.Parse(routeData.Values["solution"].ToString()));
            ViewBag.Solution = Solution;
            base.Initialize(requestContext);
        }
        public ActionResult Summary()
        {
            return View(Solution);
        }
        public ActionResult Token()
        {
            return View();
        }
    }
}
